// const Realm = require('realm');
// 新建表模型
export const BookSchema = {
    name: 'BookDir',
    version: 0,
    primaryKey: 'uid',  //使用时间戳  // 官方没给出自增长的办法,而且一般不会用到主键,这也解决了重复访问的问题,而且实际开发中我们不需要主键的,让服务端管就是了
    properties: {
        // Realm supports the following basic types: bool, int, float, double, string, data, and date.
        uid: 'string',//bookId // new Date().getTime().toString()
        title: 'string',
        path: {type: 'string', default: ''},
        type: {type: 'string', default: 'txt'},
        size: {type: 'string', default: ''},
        progress: {type: 'string', default: '0%'},
        author: {type: 'string', default: ''},
        lastTime: {type: 'string', default: ''},
        image: {type: 'string', default: ''},
    }
};
export const PTest = {
    name: 'p1',
    version: 10,
    primaryKey: 'uid',  //使用时间戳  // 官方没给出自增长的办法,而且一般不会用到主键,这也解决了重复访问的问题,而且实际开发中我们不需要主键的,让服务端管就是了
    properties: {
        // Realm supports the following basic types: bool, int, float, double, string, data, and date.
        uid: 'string',//bookId // new Date().getTime().toString()
        name: 'string',
        author: {type: 'string', default: 'author'},
        progress: {type: 'string', default: '0%'},
        lastTime: {type: 'string', default: ''},
        image: {type: 'string', default: ''},
        size: {type: 'string', default: ''},
        type: {type: 'string', default: 'txt'},
        // tel_number: {type: 'string', default: '156xxxxxxxx'},   // 添加默认值的写法
    }
};


class DBUtils {

    constructor(schema) {
    }


    _write = (schema, data) => {
    };

    _query(schema) {
    };

    _queryLastUid(schema) {
    }

    // 根据条件查询
    _queryFilter = (schema, filter) => {
    };

    _upData = async (schema, data) => {
    };

    // 删除
    _delForUid = (schema, uid) => {
    };
    // 删除全部
    _clearAll = async (schema) => {
    };
}

export default DBUtils;